// 车站类型
export interface Station {
  id: number
  stationCode: string
  stationName: string
  city: string
  createdAt?: string
}

// 车次类型
export interface Train {
  id: number
  trainNumber: string
  trainType: TrainType
  startStationName: string
  endStationName: string
  startStationCode: string
  endStationCode: string
  departureTime: string
  arrivalTime: string
  travelDate: string
  status: TrainStatus
}

// 车次类型枚举
export type TrainType = 'G' | 'D' | 'C' | 'Z' | 'T' | 'K'

// 车次状态枚举
export type TrainStatus = 'ACTIVE' | 'CANCELLED'

// 创建车次请求
export interface CreateTrainRequest {
  trainNumber: string
  trainType: TrainType
  startStationId: number
  endStationId: number
  departureTime: string
  arrivalTime: string
  travelDate: string
}

// 车厢类型
export interface Carriage {
  id: number
  trainId: number
  trainNumber: string
  carriageNumber: number
  carriageType: CarriageType
  totalSeats: number
  availableSeats: number
}

// 座位类型
export interface Seat {
  id: number
  carriageId: number
  carriageNumber: number
  trainNumber: string
  seatNumber: string
  seatType: SeatType
  price: number
  isAvailable: boolean
}

// 车厢类型枚举
export type CarriageType = 'FIRST_CLASS' | 'SECOND_CLASS' | 'SLEEPER' | 'STANDING'

// 座位类型枚举
export type SeatType = 'WINDOW' | 'AISLE' | 'MIDDLE'

// 创建车厢请求
export interface CreateCarriageRequest {
  trainId: number
  carriageNumber: number
  carriageType: CarriageType
  totalSeats: number
}

// 创建座位请求
export interface CreateSeatRequest {
  carriageId: number
  seatNumber: string
  seatType: SeatType
  price: number
}

// 用户类型
export interface User {
  id: number
  username: string
  realName: string
  phone: string
  idCard: string
  role: UserRole
  createdAt?: string
  updatedAt?: string
}

// 订单类型
export interface Order {
  id: number
  orderNumber: string
  userId: number
  userName: string
  totalAmount: number
  orderStatus: OrderStatus
  orderType: OrderType
  createdAt: string
  updatedAt?: string
  tickets: Ticket[]
}

// 票务类型
export interface Ticket {
  id: number
  orderId: number
  orderNumber: string
  trainNumber: string
  carriageNumber: string
  seatNumber: string
  passengerName: string
  passengerIdCard: string
  startStationName: string
  endStationName: string
  departureTime: string
  arrivalTime: string
  ticketPrice: number
  ticketStatus: TicketStatus
  createdAt: string
}

// 用户角色枚举
export type UserRole = 'ADMIN' | 'USER'

// 订单状态枚举
export type OrderStatus = 'PENDING' | 'PAID' | 'CANCELLED' | 'REFUNDED'

// 订单类型枚举
export type OrderType = 'DIRECT' | 'TRANSFER'

// 票务状态枚举
export type TicketStatus = 'VALID' | 'USED' | 'CANCELLED' | 'REFUNDED'

// 购票请求
export interface TicketPurchaseRequest {
  userId: number
  tickets: TicketInfo[]
}

// 购票信息
export interface TicketInfo {
  trainId: number
  seatId: number
  passengerName: string
  passengerIdCard: string
  startStationId: number
  endStationId: number
}

// 登录请求
export interface LoginRequest {
  username: string
  password: string
}

// API响应类型
export interface ApiResponse<T> {
  success: boolean
  message: string
  data: T
}

// 退票请求
export interface RefundTicketRequest {
  orderId: number
  reason?: string
}

// 改签请求
export interface RescheduleTicketRequest {
  originalOrderId: number
  newTrainId: number
  newSeatId: number
  travelDate: string
  reason?: string
}

// 支付记录类型
export interface Payment {
  id: number
  orderId: number
  paymentMethod: string
  amount: number
  paymentStatus: string
  createdAt: string
}

// 换乘路线类型
export interface TransferRoute {
  firstTrain: Train
  secondTrain: Train
  transferStationId: number
  transferStationName: string
  transferWaitTime: string
  totalDuration: number
  totalPrice: number
}

// 换乘查询请求
export interface TransferSearchRequest {
  startStationId: number
  endStationId: number
  travelDate: string
  maxTransferWait?: number
}

// 换乘票务购买请求
export interface TransferTicketPurchaseRequest {
  userId: number
  transferTickets: TransferTicketInfo[]
}

// 换乘票务信息
export interface TransferTicketInfo {
  firstTrainId: number
  firstSeatId: number
  secondTrainId: number
  secondSeatId: number
  passengerName: string
  passengerIdCard: string
  startStationId: number
  transferStationId: number
  endStationId: number
}